package common;

import config.commonconfig;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.params.SetParams;

/**
 * @Description
 * @auther lileilei
 * @create 2020-01-04 15:11
 */
public class RedisOpearting {
    public String setkey(String key, Object value){
        Jedis pool=new Jedis(commonconfig.redisurl,commonconfig.redisport);
        SetParams setParams=new SetParams();
        setParams.px(1000*10);
        String result = pool.set(key, (String) value, setParams);
        pool.close();
        pool.close();
        return result;
    }

    public  Object getkey(String key){
        Jedis jedis=new Jedis(commonconfig.redisurl,commonconfig.redisport);
       Object object=jedis.get(key);
        jedis.close();
        return object;
    }
}
